package com.sec.android.app.myfiles.launch;

import android.app.Activity;
import android.content.Intent;

import com.sec.android.app.myfiles.info.AppConstants;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.module.abstraction.FileRecord.CategoryType;
import com.sec.android.app.myfiles.module.abstraction.FileRecord.StorageType;
import com.sec.android.app.myfiles.module.local.category.CategoryFileRecord;
import com.sec.android.app.myfiles.navigation.NavigationInfo;
import com.sec.android.app.myfiles.navigation.NavigationInfo.NavigationMode;
import com.sec.android.app.myfiles.navigation.NavigationManager;

public class HandleViewCategoryImp extends AbsHandleLaunchImp {
    @Override
    public boolean isMyJob(Intent intent) {
        boolean bRet = false;

        final String action = intent.getAction();
        if (AppConstants.Action.VIEW_CATEGORY.equals(action)) {
            bRet = true;
        }

        return bRet;
    }

    @Override
    public boolean _handleStart(int processId, Activity activity, Intent intent) {

        NavigationManager navigationMgr = NavigationManager.getInstance(processId);
        CategoryType category = getCategory(intent);
        FileRecord record = FileRecord.createFileRecord(StorageType.Category, CategoryFileRecord.getCategoryPath(category));
        NavigationInfo info = NavigationInfo.getInstance(NavigationMode.Normal, record);
        navigationMgr.enter(info);

        return true;

    }
}
